package com.pasabahceambalaj.entity;

// Generated Oct 8, 2013 12:01:41 AM by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.security.management.RoleName;

/**
 * Rol generated by hbm2java
 */
@Entity
@Table(name = "rol", catalog = "ambalaj", uniqueConstraints = @UniqueConstraint(columnNames = "kod"))
public class Rol implements java.io.Serializable {

	private Long id;
	private int version;
	private Firma firma;
	private String kod;
	private String ad;

	public Rol() {
	}

	public Rol(Firma firma, String kod, String ad) {
		this.firma = firma;
		this.kod = kod;
		this.ad = ad;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Version
	@Column(name = "version", nullable = false)
	public int getVersion() {
		return this.version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "firmaid", nullable = false)
	@NotNull
	public Firma getFirma() {
		return this.firma;
	}

	public void setFirma(Firma firma) {
		this.firma = firma;
	}

	@Column(name = "kod", unique = true, nullable = false)
	@RoleName
	@NotNull
	public String getKod() {
		return this.kod;
	}

	public void setKod(String kod) {
		this.kod = kod;
	}

	@Column(name = "ad", nullable = false, length = 1000)
	@NotNull
	@Length(max = 1000)
	public String getAd() {
		return this.ad;
	}

	public void setAd(String ad) {
		this.ad = ad;
	}
}
